Learn R Programming

Rvision (version 0.6.0)

[.Rcpp_Image: Extract or Replace Parts of an Image

Description

Operators acting on Image objects to extract or replace parts.

Usage

# S3 method for Rcpp_Image
[(x, ...)

# S3 method for Rcpp_Image [(x, i = NULL, j = NULL) <- value

Arguments

x

An Image object.

...

Other arguments passed to [ when extracting parts. In this case, the function treat that image as an R array and will accept/require the same arguments.

i, j

Indices specifying elements to extract or replace. Indices are numeric vectors which values are coerced to integer as by as.integer (and hence truncated towards zero) or logical vectors which are recycled if necessary to match the dimensions of the image.

value

Vector or matrix with the data to replace the pixels. Typically, this is a matrix with the same number of rows as the number of channels in image, similar to that produced by col2rgb.

See Also

Image, col2bgr

Examples

Run this code
# NOT RUN {
balloon <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
balloon[1:100, 1:100, ]
balloon[1:100, 1:100] <- col2rgb(c("red", "green", "blue", "yellow"))

# }

Run the code above in your browser using DataLab